<template>
  <div class="container">
    <div class="dianzan" ref="show"></div>
    <!--	圆心-->
    <div
      class="circle"
      :style="{
        backgroundImage: 'url(' + img1 + ')',
      }"
    >
      <span style="line-height: 140px" @click="showanimation">2205-8组</span>
    </div>
    <!--	第一层-->
    <div class="borther">
      <div id="lopp"></div>
      <div
        class="ball"
        v-for="(item, index) in member"
        :key="index"
        :style="{
          backgroundImage: 'url(' + img2 + ')',
        }"
      >
        <p>{{ item.name }}</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      member: [
        { name: "张诗雨" },
        { name: "杨丹" },
        { name: "金钰峰" },
        { name: "潘雅芯" },
        { name: "吕仲" },
        { name: "胡超" },
        { name: "孔攀" },
        { name: "李剑" },
        { name: "汪才博" },
      ],
      img1: require("@/assets/memberpage/shadow1.png"),
      img2: require("@/assets/memberpage/shadow2.png"),
      isShow: false,
    };
  },
  mounted() {
    this.turnaround();
  },
  methods: {
    turnaround() {
      var items = document.querySelectorAll(".ball");
      // console.log(items);
      for (var i = 0; i < items.length; i++) {
        (function (i) {
          items[i].style["animation-delay"] =
            -5 - 2.3 * i + "s," + -2.3 * i + "s," + -2.3 * i + "s";
        })(i);
      }
    },
    showanimation() {
      // console.log(this.$refs.show);
      this.$refs.show.style["display"] = "block";
      this.$refs.show.style["opacity"] = 1;
    },
  },
};
</script>

<style lang="less" scoped>
.container {
  position: relative;
  transform: rotateX(20deg);
  width: 800px;
  /* height: 800px; */
  margin: 0 auto;
  background-color: #000;
  .dianzan {
    width: 84px;
    height: 100px;
    // border: 1px solid #333;
    background: url(./dianzan.png) no-repeat center center / 100% 100%;
    position: absolute;
    left: 52%;
    top: 130px;
    z-index: 100;
    display: none;
    opacity: 0;
  }
}
/*第一层*/
@keyframes animX {
  0% {
    left: 0px;
  }

  100% {
    left: 500px;
  }
}

@keyframes animY {
  0% {
    top: 0px;
  }

  100% {
    top: 300px;
  }
}

@keyframes scale {
  0% {
    transform: scale(0.4);
    z-index: 0;
  }

  50% {
    transform: scale(1);
    z-index: 3;
  }

  100% {
    transform: scale(0.5);
    z-index: 0;
  }
}

.ball {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  position: absolute;
  color: rgb(255, 255, 255);
  font-size: 26px;
  display: flex;
  /* align-items: center; */
  line-height: 50px;
  justify-content: center;
  background-size: 100% 100%;
  -webkit-background-size: 100% 100%;
  z-index: 3;
  /*动画执行一次所需时间*/
  animation-duration: 10s, 10s, 20s;
  /*动画以何种运行轨迹完成一个周期*/
  animation-timing-function: cubic-bezier(0.36, 0, 0.64, 1);
  /*动画播放次数,无线循环播放*/
  animation-iteration-count: infinite;
  /*是否轮流反向播放动画 alternate:正向播放*/
  animation-direction: alternate;
  animation-name: animX, animY, scale;
}

.ball p {
  padding-top: 28px;
  text-shadow: 0px 0px 3px rgb(12, 46, 62);
}

#lopp {
  width: 500px;
  height: 300px;
  border: 2px solid #999;
  border-radius: 50%;
  position: absolute;
  left: 70px;
  top: 80px;
}

.circle {
  position: absolute;
  top: 114px;
  left: 234px;
  border-radius: 50%;
  width: 200px;
  height: 200px;
  z-index: 3;
  color: #fff;
  text-shadow: 0px 0px 3px rgb(71, 42, 29);
  font-weight: 600;
  font-size: 32px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  cursor: pointer;
  background-size: 100% 100%;
  -webkit-background-size: 100% 100%;
}
</style>